home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / a-tags.ads < prev    next >
Text File  |  1996-01-30  |  5KB  |  116 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --                             A D A . T A G S                              --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.7 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25. with System;
  26. with System.Storage_Elements;
  27.  
  28. package Ada.Tags is
  29.  
  30.    type Tag is private;
  31.  
  32.    function Expanded_Name (T : Tag) return String;
  33.  
  34.    function External_Tag (T : Tag) return String;
  35.  
  36.    function Internal_Tag (External : String) return Tag;
  37.  
  38.    Tag_Error : exception;
  39.  
  40. private
  41.  
  42.    --  DT stands for Dispatch Table
  43.  
  44.    procedure Set_Prim_Op_Address
  45.      (DTptr    : Tag;
  46.       Position : Positive;
  47.       Value    : System.Address);
  48.    --  Given a pointer to a dispatch Table (DTptr) and a position in the
  49.    --  dispatch Table put the address of the virtual function in it (used for
  50.    --  overriding)
  51.  
  52.    function Get_Prim_Op_Address
  53.      (DTptr    : Tag;
  54.       Position : Positive)
  55.       return     System.Address;
  56.    --  Given a pointer to a dispatch Table (DTptr) and a position in the DT
  57.    --  this function returns the address of the virtual function stored in it
  58.    --  (used for dispatching calls)
  59.  
  60.    procedure Set_Inheritance_Depth
  61.      (DTptr : Tag;
  62.       Value : Natural);
  63.    --  Given a pointer to a dispatch Table, stores the value representing the
  64.    --  depth in the inheritance tree.  (used during elaboration of the tagged
  65.    --  type)
  66.  
  67.    function  Get_Inheritance_Depth (DTptr : Tag) return Natural;
  68.    --  Given a pointer to a dispatch Table, retreives the value representing
  69.    --  the depth in the inheritance tree.  (used for membership)
  70.  
  71.    procedure Set_Ancestor_Tags
  72.      (DTptr : Tag;
  73.       Value : System.Address);
  74.    --  Given a pointer to a dispatch Table, stores the address of a table
  75.    --  containing the DTptrs of the ancestors (used during elaboration of the
  76.    --  tagged type)
  77.  
  78.    function  Get_Ancestor_Tags (DTptr : Tag) return System.Address;
  79.  
  80.    --  Given a pointer to a dispatch Table, retreives the address of a table
  81.    --  containing the DTptrs of the ancestors (used for membership)
  82.  
  83.    function DT_Size
  84.      (Entry_Count : Natural)
  85.       return        System.Storage_Elements.Storage_Count;
  86.    --  give the size in 'storage_count' of the dispatch Table (used to create
  87.    --  statically the dispatch Table)
  88.  
  89.    procedure Inherit_DT
  90.     (Old_DTptr   : Tag;
  91.      New_DTptr   : Tag;
  92.      Entry_Count : Natural);
  93.    --  the dispatch Table referenced by New_DTptr 'inherits' the Entry_Count
  94.    --  first entries of the dispatch Table referenced by Old_DTptr (used when
  95.    --  deriving and the root type is CPP_Class)
  96.  
  97.    function CW_Membership (Obj_Tag : Tag; Typ_Tag : Tag) return Boolean;
  98.    --  Given the tag of an object and the tag associated to a type, return
  99.    --  true if Obj is in Typ'Class.
  100.  
  101.    type Address_Array is array (Natural range <>) of System.Address;
  102.  
  103.    type Dispatch_Table;
  104.    type Tag is access all Dispatch_Table;
  105.  
  106.    pragma Inline (Set_Prim_Op_Address);
  107.    pragma Inline (Get_Prim_Op_Address);
  108.    pragma Inline (Set_Inheritance_Depth);
  109.    pragma Inline (Get_Inheritance_Depth);
  110.    pragma Inline (Set_Ancestor_Tags);
  111.    pragma Inline (Get_Ancestor_Tags);
  112.    pragma Inline (DT_Size);
  113.    pragma Inline (Inherit_DT);
  114.    pragma Inline (CW_Membership);
  115. end Ada.Tags;
  116.